<br />
<?php 

function filterVerifyAction($userModelAlias, $record)
{
	if($record[$userModelAlias]['adminVerified'] == 0)
	{
		return true; // keep the link same for unverified users
	}
	return false;
}

function filterEmailVerifyAction($userModelAlias, $record)
{
	if($record[$userModelAlias]['emailVerified'] == 0)
	{
		return true; // keep the link same for unverified users
	}
	return false;
}
$index->setData($users, $userModelAlias);

$model = ClassRegistry::getObject($userModelAlias);
$index->showFields($model->getFields('group', 'grid'));
$index->sortableFields($model->getFields('group', 'grid'));

// fixed functions
$userIdVar = ':'.$userModelAlias.'.id';
$index->setAction('View', array('action'=>'view', $userIdVar));
$index->setAction('Delete', array('action'=>'delete', $userIdVar));
$index->setAction('Change Password', array('action'=>'change_password', $userIdVar));

if($model->emailVerification)
{
	$index->setAction('Resend Verification', array('action'=>'resendSignupNotification', $userIdVar), array(), false, true, 'filterEmailVerifyAction');
}

if($model->adminVerification)
{
	$index->setAction('Verify', array('action'=>'verify', $userIdVar), array(), false, true, 'filterVerifyAction');
}
if(isInstalled('newsletters'))
$index->addButton('Email', array('plugin'=>'newsletters','controller'=>'bulk_emails','action'=>'prepareBulkEmail', 'prefix'=>'admin'));

echo $index->display();
?>